package zwierzaki;

public class LiskovSubstitutionPrincipalVioloationDEMO {

	public static void main(String[] args) {

		SuperClass object1 = new SuperClass();
		SubClass object2 = new SubClass();
		doSomething(object1);
		doSomething(object2);
		System.out.println(object1.getClass());
	}

	private static void doSomething(SuperClass object) {
		if(object.getClass() == zwierzaki.SuperClass.class){
			System.out.println("Whoa I got the actual superclass object so lets call myMethod");
			object.myMethod();
		}
		else{
			System.out.println("Just recieved an actual subclass object so lets call subMethod");
			((SubClass) object).subMethod();
		}
	}

}
